#include "FieldMesh.h"

using namespace Game;
using namespace Chess;

FieldMesh::FieldMesh(Mesh* selectedMesh, Mesh* reachableMesh)
{
  m_markers[0] = selectedMesh;
  m_markers[1] = reachableMesh;
  SetTranslation(0,0,0);
  SetRotation(0,0,0); 
  m_transparent = 1.0f;
}

FieldMesh::~FieldMesh()
{
}

RenderDesc* FieldMesh::GetRenderData()
{
  FieldStatusEnum status = GetStatus();
  if(status == FieldStatusEnum::SELECTED)
    return m_markers[0]->GetRenderData();
  if(status == FieldStatusEnum::CANREACH)
    return m_markers[1]->GetRenderData();

  return 0;
}

bool FieldMesh::Visible()
{
  FieldStatusEnum status = GetStatus();
  return status != FieldStatusEnum::NONE;
}


AABBDesc* FieldMesh::GetAABB()
{
  FieldStatusEnum status = GetStatus();
  static AABBDesc desc;
  if(status == FieldStatusEnum::SELECTED)
    return m_markers[0]->GetAABB();
  else 
    return m_markers[1]->GetAABB();
  return new AABBDesc();
}